package com.movieManager.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONArray;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import com.movieManager.bean.bean_movie;
import com.movieManager.impl.implements_movie;

public class action_Image extends DispatchAction{

	
	public ActionForward getMovie_aiqing(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		implements_movie immo=new implements_movie();
		List <bean_movie>list=immo.selectCatagry("movie_aiqing");
		//request.setAttribute("movielist",list);
		//return mapping.getInputForward();
		JSONArray jsonArrayFromList = JSONArray.fromObject(list); 
		System.out.println(jsonArrayFromList);
		response.setContentType("application/json;charset=utf-8");
		response.getWriter().print(jsonArrayFromList);
		return null;
	}

	public ActionForward getMovie_guzhuang(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		implements_movie immo=new implements_movie();
		List <bean_movie>list=immo.selectCatagry("movie_guzhuang");
		//request.setAttribute("movielist",list);
		//return mapping.getInputForward();
		JSONArray jsonArrayFromList = JSONArray.fromObject(list); 
		System.out.println(jsonArrayFromList);
		response.setContentType("application/json;charset=utf-8");
		response.getWriter().print(jsonArrayFromList);
		return null;
	}
	
	public ActionForward getMovie_shenhua(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		implements_movie immo=new implements_movie();
		List <bean_movie>list=immo.selectCatagry("movie_shenhua");
		//request.setAttribute("movielist",list);
		//return mapping.getInputForward();
		JSONArray jsonArrayFromList = JSONArray.fromObject(list); 
		System.out.println(jsonArrayFromList);
		response.setContentType("application/json;charset=utf-8");
		response.getWriter().print(jsonArrayFromList);
		return null;
	}
	
	
	public ActionForward getMovie_qihuan(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		implements_movie immo=new implements_movie();
		List <bean_movie>list=immo.selectCatagry("movie_qihuan");
		//request.setAttribute("movielist",list);
		//return mapping.getInputForward();
		JSONArray jsonArrayFromList = JSONArray.fromObject(list); 
		System.out.println(jsonArrayFromList);
		response.setContentType("application/json;charset=utf-8");
		response.getWriter().print(jsonArrayFromList);
		return null;
	}
	
	public ActionForward getMovie_meiju(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		implements_movie immo=new implements_movie();
		List <bean_movie>list=immo.selectCatagry("movie_meiju");
		//request.setAttribute("movielist",list);
		//return mapping.getInputForward();
		JSONArray jsonArrayFromList = JSONArray.fromObject(list); 
		System.out.println(jsonArrayFromList);
		response.setContentType("application/json;charset=utf-8");
		response.getWriter().print(jsonArrayFromList);
		return null;
	}
	
	public ActionForward getMovie_yingju(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		implements_movie immo=new implements_movie();
		List <bean_movie>list=immo.selectCatagry("movie_yingju");
		//request.setAttribute("movielist",list);
		//return mapping.getInputForward();
		JSONArray jsonArrayFromList = JSONArray.fromObject(list); 
		System.out.println(jsonArrayFromList);
		response.setContentType("application/json;charset=utf-8");
		response.getWriter().print(jsonArrayFromList);
		return null;
	}
	
	public ActionForward getMovie_kongbu(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		implements_movie immo=new implements_movie();
		List <bean_movie>list=immo.selectCatagry("movie_kongbu");
		//request.setAttribute("movielist",list);
		//return mapping.getInputForward();
		JSONArray jsonArrayFromList = JSONArray.fromObject(list); 
		System.out.println(jsonArrayFromList);
		response.setContentType("application/json;charset=utf-8");
		response.getWriter().print(jsonArrayFromList);
		return null;
	}
	
	public ActionForward getMovie_dongman(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		implements_movie immo=new implements_movie();
		List <bean_movie>list=immo.selectCatagry("movie_dongman");
		//request.setAttribute("movielist",list);
		//return mapping.getInputForward();
		JSONArray jsonArrayFromList = JSONArray.fromObject(list); 
		System.out.println(jsonArrayFromList);
		response.setContentType("application/json;charset=utf-8");
		response.getWriter().print(jsonArrayFromList);
		return null;
	}
}
